package cn.itcast.dao;

import cn.itcast.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface StudentDao {
    @Select("SELECT * FROM student WHERE username=#{arg0} AND password=#{arg1}")
    Student findByStudentnameAndPassword(String username,String password);

    @Select("SELECT * FROM student")
    ArrayList<Student> findAllStudent();

    @Insert("INSERT INTO student(username,password) VALUES(#{arg0},#{arg1}) ")
    int insertStudent(String username,String password);

    @Delete("DELETE FROM student WHERE id=#{id}")
    void deleteStudent(Integer id);

    @Select("SELECT * FROM student WHERE id=#{id}")
    Student findStudentById(Integer update_id);

    @Update("UPDATE student SET username=#{username},password=#{password} WHERE id=#{id}")
    void updateStudent(Student stu);
}
